Skip to content

feat(s2-resource): FRBC as a built-in control type (#125) - #136

Open
dirkjanfaber wants to merge 1 commit into
mainfrom
feat/125-frbc-in-s2-resource
Open

dirkjanfaber wants to merge 1 commit into
mainfrom
feat/125-frbc-in-s2-resource

Conversation

@dirkjanfaber

Copy link
Copy Markdown
Collaborator

A battery, boiler or buffer tank needed s2-rm, s2-frbc and s2-frbc-config wired up by hand, with fill rates worked out in %/s or °C/s. s2-resource now does FRBC the way it does OMBC: pick a preset, enter the capacity and the power of each operation mode.

The runtime only reads the system description JSON. The Friendly form is saved next to it and shown only while it would write exactly that JSON. So JSON edited by hand is never overwritten by a form that does not know about the edit, without a flag saying which view was used last.

S2 ids must not change on a save: a CEM holds instructions and timer statuses that refer to them. The actuator id and the operation mode ids are saved with the form; timer and transition ids are derived from those.

An instruction is confirmed by the flow with ActuatorConfirmation, or by the node itself with the new auto-confirm option of FRBCController. That option is a property of its own, off by default, so a node that used OMBC's auto-confirm does not silently confirm FRBC instructions too.

A node without a valid FRBC system description does not start. An RM that advertises FRBC and then has nothing to describe leaves the CEM waiting.

Closes #125.

A battery, boiler or buffer tank needed s2-rm, s2-frbc and s2-frbc-config
wired up by hand, with fill rates worked out in %/s or °C/s. s2-resource
now does FRBC the way it does OMBC: pick a preset, enter the capacity and
the power of each operation mode.

The runtime only reads the system description JSON. The Friendly form is
saved next to it and shown only while it would write exactly that JSON.
So JSON edited by hand is never overwritten by a form that does not know
about the edit, without a flag saying which view was used last.

S2 ids must not change on a save: a CEM holds instructions and timer
statuses that refer to them. The actuator id and the operation mode ids
are saved with the form; timer and transition ids are derived from those.

An instruction is confirmed by the flow with ActuatorConfirmation, or by
the node itself with the new auto-confirm option of FRBCController. That
option is a property of its own, off by default, so a node that used
OMBC's auto-confirm does not silently confirm FRBC instructions too.

A node without a valid FRBC system description does not start. An RM
that advertises FRBC and then has nothing to describe leaves the CEM
waiting.

Closes #125.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Negative timer values silently remove operating constraints, and FRBC power-measurement inputs are dropped over WebSocket and External transports.

2 open issues
What changed in this PR

Adds FRBC as a built-in control type in s2-resource, reusing the existing FRBC controller so common storage devices no longer require separately wired FRBC nodes.

Changes:

  • Adds battery, boiler, heat-pump buffer and custom presets with power-derived fill rates, stable IDs and guarded Friendly/JSON editing.
  • Integrates configuration validation, fill-level input, instruction routing and a separate, opt-in FRBC auto-confirm setting.
  • Adds tests, help text and a simulated boiler example.
File Description
test/​resources/​s2-frbc-editor.test.ts Tests presets, fill rates, timers, stable IDs and example consistency.
test/​resources/​s2-common.test.ts Tests hiding empty validation error boxes.
test/​nodes/​s2-resource.test.ts Tests built-in FRBC routing, confirmations and invalid configuration handling.
test/​lib/​frbc-controller.test.ts Tests optional instruction auto-confirmation.
src/​nodes/​s2-resource/​index.ts Integrates FRBC validation, controller setup and input routing.
src/​nodes/​s2-resource/​index.html Adds FRBC configuration controls, validation and help.
src/​lib/​s2/​frbc-controller.ts Exports flow topics and adds opt-in auto-confirmation.
resources/​s2-frbc-editor.js Generates preset-based descriptions, fill rates, timers and stable IDs.
resources/​s2-common.js Hides error boxes when validation supplies no messages.
README.md Documents built-in FRBC and the boiler example.
examples/​s2-resource-frbc-boiler.json Adds a simulated boiler flow with instruction confirmation.
CHANGELOG.md Records built-in FRBC support and its configuration options.

Review effort: Balanced

}
if (!(isNumber(form.size) && form.size > 0)) problems.push(preset.sizeLabel + ': enter a value above 0')
if (form.preset === 'heatpump' && !(isNumber(form.cop) && form.cop > 0)) problems.push('COP: enter a value above 0')
if (form.modes.length === 0) problems.push('Add at least one operation mode')
done()
} else {
ombcController.handleInput(msg, done)
controller.handleInput(msg, done)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

s2-resource: add FRBC as control type

2 participants